package com.ju.demo.controller;

import com.ju.demo.entity.FlowMsg;
import com.ju.demo.service.FlowMsgService;
import com.ju.demo.util.LogUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/exchangeTeam")
public class FlowMsgController {

    @Autowired
    private FlowMsgService flowMsgService;

    @ApiOperation("查询流转信息BY班级序号")
    @ResponseBody
    @GetMapping("/flowMsg/{id}")
    public String findFlowMsg(@PathVariable("id")Integer id){
        if (id==null){
            LogUtil.write("id为空！");
            return "false";
        }
        FlowMsg msg = flowMsgService.findFlowMsgByTeamId(id);
        if (msg == null){
            LogUtil.write("查询流转信息失败！");
            return "false";
        }
        LogUtil.write("流转信息：" + msg);
        return "true";
    }
}
